package com.mhy.netsafe.db;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.mhy.netsafe.utils.cache.LoginCache;
import com.mhy.netsafe.utils.picture.DayStep;
import com.mhy.netsafe.utils.picture.SportInfo;
import com.mhy.netsafe.utils.picture.UserInfo;

import com.mhy.netsafe.db.LoginCacheDao;
import com.mhy.netsafe.db.DayStepDao;
import com.mhy.netsafe.db.SportInfoDao;
import com.mhy.netsafe.db.UserInfoDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig loginCacheDaoConfig;
    private final DaoConfig dayStepDaoConfig;
    private final DaoConfig sportInfoDaoConfig;
    private final DaoConfig userInfoDaoConfig;

    private final LoginCacheDao loginCacheDao;
    private final DayStepDao dayStepDao;
    private final SportInfoDao sportInfoDao;
    private final UserInfoDao userInfoDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        loginCacheDaoConfig = daoConfigMap.get(LoginCacheDao.class).clone();
        loginCacheDaoConfig.initIdentityScope(type);

        dayStepDaoConfig = daoConfigMap.get(DayStepDao.class).clone();
        dayStepDaoConfig.initIdentityScope(type);

        sportInfoDaoConfig = daoConfigMap.get(SportInfoDao.class).clone();
        sportInfoDaoConfig.initIdentityScope(type);

        userInfoDaoConfig = daoConfigMap.get(UserInfoDao.class).clone();
        userInfoDaoConfig.initIdentityScope(type);

        loginCacheDao = new LoginCacheDao(loginCacheDaoConfig, this);
        dayStepDao = new DayStepDao(dayStepDaoConfig, this);
        sportInfoDao = new SportInfoDao(sportInfoDaoConfig, this);
        userInfoDao = new UserInfoDao(userInfoDaoConfig, this);

        registerDao(LoginCache.class, loginCacheDao);
        registerDao(DayStep.class, dayStepDao);
        registerDao(SportInfo.class, sportInfoDao);
        registerDao(UserInfo.class, userInfoDao);
    }
    
    public void clear() {
        loginCacheDaoConfig.clearIdentityScope();
        dayStepDaoConfig.clearIdentityScope();
        sportInfoDaoConfig.clearIdentityScope();
        userInfoDaoConfig.clearIdentityScope();
    }

    public LoginCacheDao getLoginCacheDao() {
        return loginCacheDao;
    }

    public DayStepDao getDayStepDao() {
        return dayStepDao;
    }

    public SportInfoDao getSportInfoDao() {
        return sportInfoDao;
    }

    public UserInfoDao getUserInfoDao() {
        return userInfoDao;
    }

}
